import React from 'react'
import { useNavigate, useSearchParams } from 'umi'
export default function index() {
  const navigate = useNavigate();
  const [searchParams] = useSearchParams();
  const userLogin = () => {
    setTimeout(() => {
      const token = 'eee-fff-ddd';
      localStorage.setItem('token', token);
      if (searchParams.get('from')) {
        const from = searchParams.get('from') as string;
        navigate(from)
      }else {
        navigate('/home')
      }
      
     
    }, 1000)
  }
  return (
    <div>
      <h2>登录页</h2>
      <button onClick={userLogin}>点击登录</button>
    </div>
  )
}
